

    <img height="600" src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fhbimg.b0.upaiyun.com%2Fc89c082a7a5d667bc1539e47ffbea891e5fe15814ecf3-0AnT4F_fw658&refer=http%3A%2F%2Fhbimg.b0.upaiyun.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1630489582&t=a0cbe1f6f7c79ad2456b0c632061584c" data="./imgs/1.jpg" alt=""><hr>
    <img height="600" src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fhbimg.b0.upaiyun.com%2Fc89c082a7a5d667bc1539e47ffbea891e5fe15814ecf3-0AnT4F_fw658&refer=http%3A%2F%2Fhbimg.b0.upaiyun.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1630489582&t=a0cbe1f6f7c79ad2456b0c632061584c" data="./imgs/2.jpg" alt=""><hr>
    <img height="600" src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fhbimg.b0.upaiyun.com%2Fc89c082a7a5d667bc1539e47ffbea891e5fe15814ecf3-0AnT4F_fw658&refer=http%3A%2F%2Fhbimg.b0.upaiyun.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1630489582&t=a0cbe1f6f7c79ad2456b0c632061584c" data="./imgs/3.jpg" alt=""><hr>
    <img height="600" src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fhbimg.b0.upaiyun.com%2Fc89c082a7a5d667bc1539e47ffbea891e5fe15814ecf3-0AnT4F_fw658&refer=http%3A%2F%2Fhbimg.b0.upaiyun.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1630489582&t=a0cbe1f6f7c79ad2456b0c632061584c" data="./imgs/4.jpg" alt=""><hr>
    <img height="600" src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fhbimg.b0.upaiyun.com%2Fc89c082a7a5d667bc1539e47ffbea891e5fe15814ecf3-0AnT4F_fw658&refer=http%3A%2F%2Fhbimg.b0.upaiyun.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1630489582&t=a0cbe1f6f7c79ad2456b0c632061584c" data="./imgs/5.jpg" alt=""><hr>

    <script src="./jq.js"></script>
<script src="./jquery.lazyload.js"></script>
<script>
        /* 调用插件*/
        $(function() {
        });
        </script>

<!-- js -->
<script>
        //定义t
        let t
      
     
     //先布局用loading显示图片，data输入真实地址
      //监控滚动条
      //建个空函数把代码放进去
      function lazyload(){
          //判断
          if(t)return
            //使用定时器
       t=setTimeout(()=>{
     
        //求看得见的高度：浏览器的可见高度+滚动条高度
        let h1=window.innerHeight||document.documentElement.clientHeight
        let h2=document.body.scrollTop||document.documentElement.scrollTop
        let showTotalHeight=h1+h2
     //获取所有img
        let imgsObj=document.querySelectorAll('img')
        imgsObj.forEach((item,index)=>{//遍历每个标签对象
         //写个判断
        let imgTop=item.offsetTop
        if(imgTop<=showTotalHeight){
        item.src=item.getAttribute('data')
            
        }
     
     
     
     })
     t=null
     },1000)
     
      }
      
      
       
      window.onscroll=lazyload
      lazyload() 
     
        
     
     
     
     
     
     
     
     
    
     </script> 
           
